package com.example.yls.drawdoublebuffe;

import android.animation.ValueAnimator;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

public class MainActivity extends AppCompatActivity {

    /*private static final String TAG="MainActivity";
    private MyView myView;
    private float radius=0;*/

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        /*myView=findViewById(R.id.my_view);

        findViewById(R.id.btnStart).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ValueAnimator valueAnimator=ValueAnimator.ofFloat(0,500);
                valueAnimator.setDuration(5000);
                valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                    @Override
                    public void onAnimationUpdate(ValueAnimator valueAnimator) {
                        float value= (float) valueAnimator.getAnimatedValue();
                        Log.e(TAG,"value = "+value);
                        myView.setCenter(value);
                    }
                });
                valueAnimator.start();
            }
        });

        findViewById(R.id.btn2).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        while (true && radius<400){
                            try {
                                Thread.sleep(20);
                            } catch (InterruptedException e) {
                                e.printStackTrace();
                            }
                            radius+=1;
                            myView.setRadius(radius);
                        }
                    }
                }).start();
            }
        });*/
    }
}
